package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.service.QueryReportService;
import com.itheima.service.ReportService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Tony
 * @create 2021-12-09 19:43
 */
@RestController
@RequestMapping("/queryReport")
public class ReportController {

    @Reference
    private QueryReportService queryReportService;

    @GetMapping("/findAllReportByMemberId")
    public Result findAllReportByMemberId(Integer memberId,String q) {
        try {
            List<Map<String, Object>> allReport = queryReportService.findAllReportByMemberId(memberId,q);
            return new Result(true,"查询报告成功",allReport);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"查询报告失败");


        }
    }
}
